<!doctype html>
<html lang="zh">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="../vendor/bootstrap/dist/css/bootstrap.min.css">
    <link rel="stylesheet" href="../vendor/bootstrap-icons/font/bootstrap-icons.css">
    <title>bs</title>

<body>

<div class="container p-2">
    <div class="row g-2">
        <div class="col-md-6">
            <div class="qtab1"></div>
            <button class="btn btn-success mt-2 btn1">滚动到页面1</button>
            <button class="btn btn-success mt-2 btn2">滚动到页面8</button>
        </div>
    </div>
</div>


<script src="../vendor/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
<script src="../vendor/jquery/dist/jquery.min.js"></script>
<script src="../vendor/bootstrap-quicktab/dist/js/bootstrap-quicktab.min.js"></script>

<script>
    $(function () {

        new Quicktab({
            selector: '.qtab1',
            tabs: [
                {title: '页面1', url: 'child2.html?a=1'},
                {title: '页面2', url: 'child2.html?a=2'},
                {title: '页面3', url: 'child2.html?a=3'},
                {title: '页面4', url: 'child2.html?a=4'},
                {title: '页面5', url: 'child2.html?a=5'},
                {title: '页面6', url: 'child2.html?a=6'},
                {title: '页面7', url: 'child2.html?a=7'},
                {title: '页面8', url: 'child2.html?a=8'},
                {title: '页面9', url: 'child2.html?a=9'},
                {title: '页面10', url: 'child2.html?a=10'},
            ]
        });

        $('.btn1').on('click', function () {
            Quicktab.get('.qtab1').scrollToTabById(Quicktab.getTabIdByUrl('child2.html?a=1'));
        })

        $('.btn2').on('click', function () {
            Quicktab.get('.qtab1').scrollToTabById(Quicktab.getTabIdByUrl('child2.html?a=8'));
        })

    })


</script>

</body>
</html>
